<?php

require_once "../config/share_config.php";
$config = require_once "../config/config.php";


?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
	<title>分享链接列表</title>
	<link rel="stylesheet" id="templatecss" type="text/css" href="../css/basic-grey.css">
	<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>

<style type="text/css">
.box{
	border:1px solid #000000;
	padding:15px 15px 15px 15px;
	width: 220px;
	font-size: 14px;
	line-height: 20px;
	height:115px;
	float: left;
}
.desc{
	width:150px;/*要显示文字的宽度*/
	overflow:hidden;
	text-overflow:ellipsis;
	display:-webkit-box;
	-webkit-box-orient:vertical;
	-webkit-line-clamp:3;
	font-size: 12px;
	line-height:18px;
	color:#b2b2b2;
	float: left;
	margin-top: 10px;
}
.share-img{
	float: left;
	width: 50px;
	height: 50px;
}
.share-img img{
	width: 40px;
	height: 40px;
	padding: 10px 0 0 10px;
	margin-top: 10px;
}
.content-right{
	width: 200px;
	float: left;
	margin-left: 20px;
}
.content-right div{
	padding:5px 5px 5px 5px;
}
.btn{
	border: 1px solid #000000;
}
.edit{
	float: left;
	width: 40%;
	margin-top:10px;
	text-align: center;
}
 .del{
 	float: left;
	width: 40%;
	margin-top:10px;
	margin-left: 5px;
	text-align: center;
 }
 .preview{
 	float: left;
 	width: 40%;
 	margin-top: 10px;
 	text-align: center;
 	text-decoration:none;
 	padding: 5px 5px 5px 5px;
 }
/* .content-box{
 	margin-bottom:155px;
 }*/
</style>

<div class="basic-grey">
	<div class="header">
		<center><h1>分享链接列表<span>Shared Link List.</span></h1></center>
	</div>
	<div class="content">
		<?php foreach ($shareData as $key => $value): ?>	
			<div class="content-box" style="padding-bottom:155px;">
				<div class="box">
					<div class="share-title"><?php echo $value['title']; ?></div>
					<div class="desc"><?php echo $value['desc']; ?></div>
					<div class="share-img"><img src="<?php echo $value['imgUrl']; ?>"></div>
				</div>
				<div class="content-right">
					<div>分享链接:</div>
					<div><?php echo $config['shareUrl'].'?id='.$key.'&page='.$value['page']; ?></div>
					<div class="btn edit" data-id="<?php echo $key; ?>">编辑</div>
					<div class="btn del" data-id="<?php echo $key; ?>">删除</div>
					<a class="btn preview" href="<?php echo $value['link']; ?>"  target="_Blank">浏览落地页</a>
					<a class="btn preview" href="<?php echo $config['shareUrl'].'?id='.$key.'&page='.$value['page']; ?>"  target="_Blank">去分享</a>
				</div>
			</div>
		<?php endforeach ?>
		<!-- 
		<div class="content-box"  style="padding-bottom:155px;">
			<div class="box">
				<div class="share-title">99%女性都不知道的祛斑妙招，一下子能年轻10岁！</div>
				<div class="desc">大量的祛斑好方法,祛斑知识,教你如何祛斑,还有很多祛斑产品,民间偏方的详细介绍,网友的祛斑体验等等,和你共享最有效的祛斑方法、去斑小秘方、祛斑产品哪款最有效果</div>
				<div class="share-img"><img src="http://www.wxlink.com/upload/upload/images/20190722164052_0cb0c11df9161d7ca171cfb8dd4c21bb.jpg"></div>
			</div>
			<div class="content-right">
				<div>分享链接:</div>
				<div>http://www.wxlink.com/upload/index.php?id=7&page=qb6</div>
				<div class="btn edit">编辑</div>
				<div class="btn del">删除</div>
			</div>
		</div>
		<div class="content-box"  style="padding-bottom:155px;">
			<div class="box">
				<div class="share-title">99%女性都不知道的祛斑妙招，一下子能年轻10岁！</div>
				<div class="desc">大量的祛斑好方法,祛斑知识,教你如何祛斑,还有很多祛斑产品,民间偏方的详细介绍,网友的祛斑体验等等,和你共享最有效的祛斑方法、去斑小秘方、祛斑产品哪款最有效果</div>
				<div class="share-img"><img src="http://www.wxlink.com/upload/upload/images/20190722164052_0cb0c11df9161d7ca171cfb8dd4c21bb.jpg"></div>
			</div>
			<div class="content-right">
				<div>分享链接:</div>
				<div>http://www.wxlink.com/upload/index.php?id=7&page=qb6</div>
				<div class="btn edit">编辑</div>
				<div class="btn del">删除</div>
			</div>
		</div> -->
	</div>
		
</div>
<script type="text/javascript">
$('.edit').click(function(){
	var id = $(this).attr('data-id');
	window.location.href = './index.php?id='+id;
});

$('.del').click(function(){
	var id = $(this).attr('data-id');
	if(confirm("确定删除此条分享链接吗？")){
		$.ajax({
			url:'../control.php?act=del',
			type:'post',
			data:{id,id},
			dataType:'json',
			success:function(data){
				console.log(data);
				if (data.code != 0) {
					alert(data.msg);
					setTimeout(window.location.reload(),2000);
				}else{
					alert(data.msg);
				}
			}
		});
	}
});
</script>

</body>
</html>